package test

import ninenineqs._

/**
  * Created by wyc on 6/11/2017.
  * Reverse a list.
  * Example:
  * scala> reverse(List(1, 1, 2, 3, 5, 8))
  * res0: List[Int] = List(8, 5, 3, 2, 1, 1)
  */

class test_p05 extends UnitSpec{
  feature(this.getClass.toString) {
    val L1 = List(1, 2, 3, 4, 5, 6)
    val L2 = List[Int]()
    val L3 = List(4)

    val Ts:List[(List[Int]) => List[Int]]=List(
      p05.reverse_v1,
      p05.reverse_v2,
      p05.reverse_v3
    )

    var v = 1
    for ( func <- Ts ) {
      scenario("reverse_v" + v) {
        assert(func(L1) == List(6, 5, 4, 3, 2, 1))
        assert(func(L2) == List[Int]())
        assert(func(L3) == List(4))
      }
      v += 1
    }
  }
}
